<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <base th:href="@{/}">
    <meta charset="UTF-8">
    <title>添加病例</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="css/style1.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript">
        // 表单验证函数
        function validateRecordForm() {
            var name = document.getElementById('name').value;
            var cno = document.getElementById('cno').value;
            var detail = document.getElementById('detail').value;
            var dname = document.getElementById('dname').value;
            var date = document.getElementById('zdrq').value;

            if (name === "") {
                alert("患者姓名不能为空，请填写患者姓名！");
                return false;
            }

            if (cno === "") {
                alert("身份证号不能为空，请填写身份证号！");
                return false;
            }

            if (detail === "") {
                alert("病情不能为空，请填写病情！");
                return false;
            }

            if (dname === "") {
                alert("医生姓名不能为空，请填写医生姓名！");
                return false;
            }

            if (date === "") {
                alert("就诊日期不能为空，请填写就诊日期！");
                return false;
            }

            return true;
        }
    </script>
</head>

<body>
<div th:include="admin/header1"></div>
<main id="main">
    <section class="breadcrumbs">
        <div class="container">
            <div class="d-flex justify-content-between align-items-center">
                <ol>
                    <li><a href="#">首页</a></li>
                    <li><a href="#">添加病例</a></li>
                </ol>
            </div>
        </div>
    </section>
<div class="container mt-5">
    <form th:action="@{/admin/addRecord}"
          name="myform" method="post"
          class="form-horizontal"
          onsubmit="return validateRecordForm()">

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">患者姓名</label>
            <div class="col-sm-4 col-md-4">
                <input type="text" id="name" class="form-control"
                       placeholder="请输入患者姓名"
                       name="name"/>
            </div>
        </div>

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">身份证号</label>
            <div class="col-sm-4 col-md-4">
                <input type="text" id="cno" class="form-control"
                       placeholder="请输入身份证号"
                       name="cno"/>
            </div>
        </div>

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">病情</label>
            <div class="col-sm-4 col-md-4">
                <input type="text" id="detail" class="form-control"
                       placeholder="请输入病情"
                       name="detail"/>
            </div>
        </div>

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">医生姓名</label>
            <div class="col-sm-4 col-md-4">
                <input type="text" id="dname" class="form-control"
                       placeholder="请输入医生姓名"
                       name="dname"/>
            </div>
        </div>

        <div class="form-group has-success">
            <label class="col-sm-2 col-md-2 control-label">就诊日期</label>
            <div class="col-sm-4 col-md-4">
                <input type="date" id="zdrq" class="form-control"
                       placeholder="请输入就诊日期"
                       name="zdrq"/>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn1 btn-sm">添加</button>
            </div>
        </div>
    </form>
</div>
</main>
<script src="js/main.js"></script>
<script src="/js/bootstrap.bundle.min.js"></script>
</body>

</html>
